<template>
  <div class="fish-disease-system">
    <!-- 主标题 -->
    <!-- <h1 class="system-title" style="margin-bottom: 20px">常见鱼病监测</h1> -->

    <!-- 分类选择区 -->
    <div class="category-container">
      <div
        v-for="category in categories"
        :key="category.id"
        class="category-card"
        :class="{ selected: selectedCategory === category.id }"
        @click="selectCategory(category.id)"
      >
        <img :src="category.icon" class="category-icon" />
        <span class="category-name">{{ category.name }}</span>
        <span class="selection-tag">
          {{ selectedCategory === category.id ? "已选择" : "请选择" }}
        </span>
      </div>
    </div>
      <div class="topimg">
        常见疾病描述及处理方法
      </div>
    <!-- 疾病详情区 -->
    <div class="disease-container" v-if="selectedCategory === 'fish'">
      <!-- <h2 class="disease-title">鱼类常见疾病描述及处理方法</h2> -->

      <div
        class="disease-section"
        v-for="(disease, index) in diseases"
        :key="index"
      >
        <h3 class="disease-name">{{ disease.name }}</h3>
        <div class="disease-info">
          <div class="info-item" v-for="(item, i) in disease.details" :key="i">
            <div class="info-title">{{ item.title }}</div>
            <div class="info-content">
              <p v-for="(text, j) in item.content" :key="j">{{ text }}</p>
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- 其他分类提示 -->
    <div class="empty-container" v-else>
      <div class="empty-message">
        <img src="" class="empty-icon" />
        <p>「{{ getCategoryName(selectedCategory) }}」分类功能开发中</p>
        <p>敬请期待后续版本更新</p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      selectedCategory: "fish",
      categories: [
        { id: "fish", name: "鱼类", icon: "" },
        { id: "crustacean", name: "甲壳类", icon: "" },
        { id: "shellfish", name: "贝类", icon: "" },
        { id: "other", name: "其他", icon: "" },
      ],
      diseases: [
        {
          name: "病毒01",
          details: [
            {
              title: "1、病原",
              content: ["传染性胰脏坏死病毒", "传染性胰脏和坏死病"],
            },
            {
              title: "2、主要危害对象",
              content: ["传染性造血器官坏死病", "流行性造血器官坏死病"],
            },
            {
              title: "3、主要症状",
              content: [
                "传染性骨坏死病",
                "肛门处拖一条白色粘液便，狂游、翻滚、旋转，体表及鳍充血、突眼有腹水。",
              ],
            },
            {
              title: "4、流行情况",
              content: [
                "幼鱼从开口吃食起到3个月内为发病高峰期，在水温10~14℃时流行。",
              ],
            },
            {
              title: "5、预防措施",
              content: [
                "（1）加强综合预防措施，严格执行检疫制度，不将带病毒的鱼卵、鱼苗输出或运入。",
                "（2）发现患病鱼必须销毁，工具和水体彻底消毒。",
                "（3）对鱼卵消毒，阻断垂直传播路径。",
              ],
            },
          ],
        },
      ],
    };
  },
  methods: {
    selectCategory(category) {
      this.selectedCategory = category;
    },
    getCategoryName(id) {
      const category = this.categories.find((item) => item.id === id);
      return category ? category.name : "";
    },
  },
};
</script>

<style scoped>
.fish-disease-system {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  background-color: rgba(255, 255, 255, 0); /* 改为半透明白色 */
  color: whitesmoke;
  font-family: "Microsoft YaHei", sans-serif;
  height: 790px;
  box-sizing: border-box;
  overflow: hidden;
  border-radius: 10px;
}

.system-title {
  text-align: center;
  font-size: 28px;
  margin-bottom: 40px;
  color: #000;
}

.category-container {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 40px;
  background-color: rgba(0, 0, 0, 0.1);
}

.category-card {
  flex: 1 1 200px;
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  padding: 15px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.category-card:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.category-card.selected {
  background-color: rgba(74, 144, 226, 0.15);
  border: 1px solid #4a90e2;
}

.category-icon {
  width: 60px;
  height: 60px;
  margin-bottom: 10px;
  object-fit: contain;
}

.category-name {
  font-size: 18px;
  margin-bottom: 5px;
}

.selection-tag {
  position: absolute;
  top: -10px;
  right: -10px;
  background-color: #4a90e2;
  color: #fff;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
}

.category-card:not(.selected) .selection-tag {
  background-color: #999;
}

.disease-container {
  background-color: rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 30px;
  max-height: 1000px;
  height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #4a90e2 transparent;
}

.disease-container::-webkit-scrollbar {
  width: 6px;
}
.disease-container::-webkit-scrollbar-thumb {
  background-color: #4a90e2;
  border-radius: 3px;
}
.disease-container::-webkit-scrollbar-track {
  background: transparent;
}

.disease-title {
  font-size: 22px;
  margin-bottom: 25px;
  color: #4a90e2;
}

.disease-section {
  margin-bottom: 30px;
}

.disease-name {
  font-size: 20px;
  margin-bottom: 20px;
  color: whitesmoke;
}

.disease-info {
  border-left: 2px solid #4a90e2;
  padding-left: 20px;
}

.info-item {
  margin-bottom: 20px;
}

.info-title {
  font-weight: bold;
  margin-bottom: 10px;
  color: #4a90e2;
}

.info-content p {
  line-height: 1.8;
  margin-bottom: 8px;
  color: whitesmoke;
}

.empty-container {
  background-color: rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 60px 30px;
  text-align: center;
}

.empty-message {
  max-width: 500px;
  margin: 0 auto;
  height: 400px;
}

.empty-icon {
  width: 100px;
  height: 100px;
  margin-bottom: 20px;
  opacity: 0.6;
}

.empty-message p {
  font-size: 16px;
  line-height: 1.6;
  color: whitesmoke;
}

.topimg{
  font-size: 24px;
  height: 40px;
  background-image: url(@/assets/top.png);
  background-size: cover;
  text-align: center;
  color: whitesmoke;
}
</style>
